package com.dragon.wangyiwork.service.impl;

import com.dragon.wangyiwork.entity.User;
import com.dragon.wangyiwork.repository.UserRepository;
import com.dragon.wangyiwork.service.UserService;
import org.hibernate.criterion.Example;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;


@Service
public class UserServiceImpl implements UserService {

    @Autowired
    private UserRepository userRepository;

    @Override
    public User userLogin(User user){
        User userByUsername = userRepository.findUserByUsername(user.getUsername());
        if(userByUsername.getPassword().equals(user.getPassword())){
            return userByUsername;
        }
        return null;
    }
}
